package controler.algorithms;

import java.util.LinkedList;

public class GHSOM_LearnExtraction extends Extraction{

	int H;
	int P;
	
	public GHSOM_LearnExtraction(int History, int Prediction)
	{
		H = History;
		P = Prediction;
	}
	
	/**
	* {@inheritDoc}
	*/
	public LinkedList<double[]> extract(LinkedList<double[]> dataSet) {

		LinkedList<double[]> candidates = new LinkedList<double[]>();

		int koniec = (dataSet.size() - dataSet.size()%(H+P));
		for (int i = 0 ; i < koniec; i++)
		{
			if((i+H+P)<koniec)
			{
				double[] f = new double[H+P+1];
				for(int j=i;j<(i+H+P);j++)
				{
				double[] values = dataSet.get(j);
				f[j-i] = (1/400.0) * values[5];
				}
				f[H+P] = dataSet.get(i)[0];
				candidates.add(f);
			}
		}
		
		return candidates;
	}
}
